define(function (require) {
var zsApp = require('app');
zsApp.controller( 'rolebyRoleController',["$scope","$http","$state","$stateParams","$window","$timeout","$rootScope","$cookieStore" ,function($scope,$http,$state,$stateParams,$window,$timeout,$rootScope,$cookieStore){
		var roleIdCookieNew = $cookieStore.get('roleIdcookie');
		$scope.roleIdnew = roleIdCookieNew ;
		//ID
		$scope.userRoleId = [];
		$rootScope.paginationConfrole = {
	        currentPage: 1,
	        totalItems: 10,
	        itemsPerPage: 10,
	        pagesLength: 1,
	        perPageOptions: [10, 20, 30, 40, 50],
	        onChange: function(){
	        	console.log($scope.roleIdnew );
	        	var rolelistdate = {
	        		pageNumber	:	1,
					pageSize  	:	10,
					roleId      :   $scope.roleIdnew,
	        	}
				$http({
					
					url    : $scope.zsUrl+'digitalhome-boss/admin/roles/getUserRoleList',
					method : 'POST',
					data   :JSON.stringify(rolelistdate),
					dataType : 'json',
					contentType : 'application/json;charset=UTF-8',
				}).then(function success(res) {
						console.log(res.data.result);
						// 角色组列表页面表格
						$scope.role_tabVal = res.data.result;
						// 总共有多少条数据
						self.totalItems = res.data.length;
						//存取ID
						angular.forEach(res.data.result, function(obj, i) {
							$scope.userRoleId[i] = obj.userRoleId;
						});	
						//console.log($scope.userRoleId);
				},function error(err) {
					console.log(err);
					console.log($scope.roleIdnew );
				});
//				$scope.isRequestCurrentPage = self.currentPage;
//				$scope.isRequestItemsPerPage = self.itemsPerPage;
				
			}  
	    }
      
}])
})